//
//  YKComposePhotos.m
//  youkan
//
//  Created by 吴高烽 on 16/4/2.
//  Copyright © 2016年 Honsintech. All rights reserved.
//

#import "YKComposePhotos.h"

@implementation YKComposePhotos

-(void)setImage:(UIImage *)image{
    _image = image;
    UIImageView *imageView =[[UIImageView alloc]init];
    imageView.image =image;
    [self addSubview:imageView];
}
-(void)layoutSubviews{
    NSInteger count =self.subviews.count;

    NSInteger cols =3;
    CGFloat magerin =10;
    CGFloat wh =(self.width -(cols-1)*magerin)/cols;
    CGFloat x =0;
    CGFloat y =0;
    for (int i=0; i<count; i++) {
        UIImageView *iamgeView=self.subviews[i];
        x=i%cols*(wh+magerin);
        y=i/cols*(wh+magerin);
        iamgeView.frame =CGRectMake(x, y, wh,wh);
    }
}
@end
